CC 	:= gcc
AR  := ar

SUBDIRS := expat xml_parse_lib mdm xmlToShm

XML_INC_DIR := $(CURDIR)/include/
XML_LIB_DIR := $(CURDIR)/lib/

CFLAGS += -m32
CFLAGS += -I$(XML_INC_DIR)

LDFLAGS += -L$(XML_LIB_DIR)
LDFLAGS += -m32

export XML_INC_DIR
export XML_LIB_DIR

.PHONY: all
all: prepare $(SUBDIRS)


$(SUBDIRS): ECHO 
	make -C $@

ECHO:
	@echo "============================================"
	@echo "$(lastword $(shell pwd))"
	@echo "subdirs: $(SUBDIRS)"
	@echo "============================================"



prepare:
	@if [ ! -d include ]; then\
		mkdir include;\
	fi;
	@if [ ! -d lib ]; then\
		mkdir lib;\
	fi;


.PHONY: clean
clean:
	@for subdir in $(SUBDIRS);\
	do\
		make -C $${subdir} clean;\
	done;
	rm -rf include lib


